/*
 * Copyright 2001 Alexander Boverman and the original authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _WT_COOKIE_H
#define _WT_COOKIE_H

#include <tcl.h>
#include "WtCollection.h"

Tcl_Obj *WtNewCookieObj();
Tcl_Obj *WtCookieGetName(Tcl_Obj *cookie, Tcl_Interp *interp);
int WtCookieSetName(Tcl_Obj *cookie, Tcl_Obj *name, Tcl_Interp *interp);
int WtCookieGetValue(Tcl_Obj *cookie, Tcl_Obj **value, Tcl_Interp *interp);
int WtCookieSetValue(Tcl_Obj *cookie, Tcl_Obj *value, Tcl_Interp *interp);
int WtCookieGetAllValues(Tcl_Obj *cookie, Tcl_Obj **values, Tcl_Interp *interp);
int WtCookieSetAllValues(Tcl_Obj *cookie, Tcl_Obj *values, Tcl_Interp *interp);
Tcl_Obj *WtCookieGetExpires(Tcl_Obj *cookie, Tcl_Interp *interp);
int WtCookieSetExpires(Tcl_Obj *cookie, Tcl_Obj *expires, Tcl_Interp *interp);
int WtCookieMarkExpired(Tcl_Obj *cookie, Tcl_Interp *interp);
Tcl_Obj *WtCookieGetDomain(Tcl_Obj *cookie, Tcl_Interp *interp);
int WtCookieSetDomain(Tcl_Obj *cookie, Tcl_Obj *domain, Tcl_Interp *interp);
Tcl_Obj *WtCookieGetPath(Tcl_Obj *cookie, Tcl_Interp *interp);
int WtCookieSetPath(Tcl_Obj *cookie, Tcl_Obj *path, Tcl_Interp *interp);
Tcl_Obj *WtCookieGetSecure(Tcl_Obj *cookie, Tcl_Interp *interp);
int WtCookieSetSecure(Tcl_Obj *cookie, Tcl_Obj *secure, Tcl_Interp *interp);
int WtCookieCmd(ClientData clientData, Tcl_Interp *interp, int objc,
  Tcl_Obj *const objv[]);
int WtCookieCreateCmd(ClientData clientData, Tcl_Interp *interp, int objc,
  Tcl_Obj *const objv[]);
int WtCookieNameCmd(ClientData clientData, Tcl_Interp *interp, int objc,
  Tcl_Obj *const objv[]);
int WtCookieValueCmd(ClientData clientData, Tcl_Interp *interp, int objc,
  Tcl_Obj *const objv[]);
int WtCookieAllValuesCmd(ClientData clientData, Tcl_Interp *interp, int objc,
  Tcl_Obj *const objv[]);
int WtCookieExpiresCmd(ClientData clientData, Tcl_Interp *interp, int objc,
  Tcl_Obj *const objv[]);
int WtCookieMarkExpiredCmd(ClientData clientData, Tcl_Interp *interp, int objc,
  Tcl_Obj *const objv[]);
int WtCookieDomainCmd(ClientData clientData, Tcl_Interp *interp, int objc,
  Tcl_Obj *const objv[]);
int WtCookiePathCmd(ClientData clientData, Tcl_Interp *interp, int objc,
  Tcl_Obj *const objv[]);
int WtCookieSecureCmd(ClientData clientData, Tcl_Interp *interp, int objc,
  Tcl_Obj *const objv[]);
void WtCookieUsage(Tcl_Interp *interp, Tcl_Obj *cmd);
Tcl_Obj *WtCookieCmdGetVal(Tcl_Obj *val, Tcl_Interp *interp);
int WtCookieCmdGetVar(Tcl_Obj *var, Tcl_Obj **val,
  Tcl_Interp *interp);
int WtCookieCmdOwnVar(Tcl_Obj *var, Tcl_Obj **val,
  int *created, Tcl_Interp *interp);
Tcl_Obj *WtCookieCmdSetVar(Tcl_Obj *var, Tcl_Obj *val, Tcl_Interp *interp);
Tcl_Obj *WtNewCookieClnObj();
void WtCookieClnFree(Tcl_Obj *cln);
void WtCookieClnDup(Tcl_Obj *src, Tcl_Obj *dst);
void WtCookieClnUpdateString(Tcl_Obj *cln);
int WtCookieClnSetFromAny(Tcl_Interp *interp, Tcl_Obj *obj);
int WtCookieClnCompare(Tcl_Obj *item, Tcl_Obj *key, int *result,
  Tcl_Interp *interp);
int WtCookieClnGetKey(Tcl_Obj *item, Tcl_Obj **key,
  Tcl_Interp *interp);
int WtCookieClnGetValue(Tcl_Obj *item, Tcl_Obj **value,
  Tcl_Interp *interp);
int WtResponseCookiesCmd(ClientData clientData, Tcl_Interp *interp,
  int objc, Tcl_Obj *const objv[]);
int WtCookieClnCmd(ClientData clientData, Tcl_Interp *interp,
  int objc, Tcl_Obj *const objv[]);
void WtResponseCookiesUsage(Tcl_Interp *interp, Tcl_Obj *cmd);
void WtInitCookieCommands(Tcl_Interp *interp);
int WtConvertToCookieCln(Tcl_Obj *obj, Tcl_Interp *interp);
int WtOwnCookieCln(Tcl_Obj **objPtr, Tcl_Interp *interp);

extern struct Tcl_ObjType WtCookieClnType;
extern WtClnItemType WtCookieClnItemType;
extern const char *wtCookieEpoch;

#endif /* !_WT_COOKIE_H */
